<?php

/**
 * HistoriaClinica form base class.
 *
 * @method HistoriaClinica getObject() Returns the current form's model object
 *
 * @package    sibi-salud
 * @subpackage form
 * @author     SIBI <sibiud@gmail.com>
 */
abstract class BaseHistoriaClinicaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'usuario_id' => new sfWidgetFormPropelChoice(array('model' => 'Usuario', 'add_empty' => true)),
      'numero'     => new sfWidgetFormInputText(),
      'created_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorPropelChoice(array('model' => 'HistoriaClinica', 'column' => 'id', 'required' => false)),
      'usuario_id' => new sfValidatorPropelChoice(array('model' => 'Usuario', 'column' => 'id', 'required' => false)),
      'numero'     => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'created_at' => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'HistoriaClinica', 'column' => array('numero')))
    );

    $this->widgetSchema->setNameFormat('historia_clinica[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'HistoriaClinica';
  }


}
